<template>
  <div class="footer">
    <div @click="$router.push({name:'Index',params:{index:1}})">
      <span>
        <img v-if="index==1" src="static/img/tab1a.png" alt />
        <img v-else src="static/img/tab1.png" alt />
      </span>
      <span :class="{cyan:index==1}">资产</span>
    </div>
    <div @click="$router.push({name:'Exchange',params:{index:2}})">
      <span>
        <img v-if="index==2" src="static/img/tab2a.png" alt />
        <img v-else src="static/img/tab2.png" alt />
      </span>
      <span :class="{cyan:index==2}">兑换</span>
    </div>
    <div @click="$router.push({name:'Market',params:{index:3}})">
      <span>
        <img v-if="index==3" src="static/img/tab3a.png" alt />
        <img v-else src="static/img/tab3.png" alt />
      </span>
      <span :class="{cyan:index==3}">质押</span>
    </div>

    <div @click="$router.push({name:'My',params:{index:4}})">
      <span>
         <img v-if="index==4" :src="messageCount>0?'static/img/my4.png':'static/img/tab4a.png'" alt />
        <img v-else :src="messageCount>0?'static/img/my3.png':'static/img/tab4.png'" alt />
      </span>
      <span :class="{cyan:index==4}">我的</span>
    </div>
  </div>
</template>

<script>
import { Toast } from "mint-ui";
import { mapGetters, mapActions } from "vuex";
export default {
  props: ["index"],
  data() {
    return {
      messageCount: 0,
    };
  },
  created() {
    for (let i = 0; i < this.messageList.length; i++) {
      if (this.messageList[i].isRead == false) {
        this.messageCount++;
      }
    }
    // if (mainIndex > 1) {
    //   this.index = mainIndex;
    // }
  },
  computed: {
    ...mapGetters(["currentAccount", "wallet", "accountIndex", "messageList"]),
  },
  methods: {
    showMsg(msg) {
      Toast({
        message: msg,
        duration: 1000,
      });
    },
  },
  async mounted() {},
};
</script>
<style>
.cyan {
  color: #1C31DC;
}

.footer {
  width: 100%;
  height: 3rem;
  border-top: 1px solid rgba(220, 220, 220, 1);
  background: #fff;
  position: fixed;
  z-index: 999;
  bottom: 0px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.footer > div {
}
.footer > div > span {
  width: 100%;
  height: 50%;
  text-align: center;
  font-size: 10px;
  display: block;
}

.footer > div > span > img {
  width: 1.5625rem;
  height: 1.5625rem;
}
</style>

